package com.example.cms.web.Controller;

import com.example.cms.Dto.UserDto;
import com.example.cms.Service.IUserService;
import com.example.common.web.response.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/11/2-11-02-9:40
 * @Description：com.example.cms.web.Controller
 */
@Api(tags = "认证模块")
@RestController
@RequestMapping("/auth")
public class AuthController {

    @Autowired
    private IUserService service;

    @ApiOperation(value = "登录",notes = "用户名和密码")
    @PostMapping("/login")
    public Result login(@RequestBody @ApiParam("认证类") UserDto userDto){
        String token = service.login(userDto);
        return Result.success((Object)token);
    }
}
